package com.cnap.multiclouldmgmt.repository.master;

import com.cnap.multiclouldmgmt.model.k8sModels.NodeHistoryInfoModel;
import com.cnap.multiclouldmgmt.model.microSvc.MicroSvcDataSaveModel;
import com.cnap.multiclouldmgmt.model.microSvc.MicroSvcReqCostInfoModel;
import com.cnap.multiclouldmgmt.model.microSvc.alg.IndicatorHistoryModel;
import com.cnap.multiclouldmgmt.model.network.LinkResInfoModel;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;

/**
 * @author dyq
 * 对接数据库操作语句
 */
@Mapper
public interface MicroSvcUseInfoMapper {

    void saveMicroSvcUseInfo(MicroSvcDataSaveModel microSvcDataSaveModel);

    void saveMicroReqCostInfo(MicroSvcReqCostInfoModel microSvcReqCostInfoModel);

    List<MicroSvcDataSaveModel> getMicroSvcUseInfoByPage(@Param("k8sClusterIp") String k8sClusterIp, @Param("microSvcName") String microSvcName,
                                                         @Param("pageSize") int pageSize, @Param("offset") int offset);

    List<MicroSvcDataSaveModel> getMicroSvcUseInfoByDate(@Param("k8sClusterIp") String k8sClusterIp, @Param("microSvcName") String microSvcName,
                                                         @Param("beginTime") Date beginTime);

    List<MicroSvcReqCostInfoModel> getReqCostInfoByDate(@Param("svcId")String svcId,
                                                        @Param("beginTime") Date beginTime);

    List<MicroSvcDataSaveModel> getMicroSvcUseInfoByClusterNameMicroSvcId(
            @Param("k8sClusterName")String k8sClusterName,@Param("microSvcId")String microSvcId,
            @Param("recordTime")Date recordTime);

    Date getSvcMaxDate(@Param("k8sClusterName")String k8sClusterName,@Param("microSvcId")String microSvcId);

    void saveIndicatorHistoryModel(IndicatorHistoryModel indicatorHistoryModel);


    List<IndicatorHistoryModel> getIndicatorHistoryModelByPage(
            @Param("microSvcId")String microSvcId, @Param("offset")int offset, @Param("pageSize")int pageSize);

    int getIndicatorHistoryModelNum(@Param("microSvcId")String microSvcId);

    List<MicroSvcDataSaveModel> getMicroSvcUseInfoByDateRange(@Param("k8sClusterIp") String k8sClusterIp, @Param("microSvcName") String microSvcName,
                                                         @Param("beginTime") Date beginTime,@Param("endTime") Date endTime);

    List<MicroSvcReqCostInfoModel> getReqCostInfoByDateRange(@Param("svcId")String svcId,
                                                        @Param("beginTime") Date beginTime,@Param("endTime") Date endTime);


    void delIndictorHistoryBySvcId(@Param("microSvcId")String microSvcId);

    void saveNodeHistoryInfo(NodeHistoryInfoModel nodeHistoryInfoModel);

    List<NodeHistoryInfoModel> getNodeHistoryInfoModelsByDate(@Param("nodeName")String nodeName,
                                                              @Param("k8sClusterName") String k8sClusterName,@Param("beginTime") Date beginTime);

    void bachtInsertLinkRes(List<LinkResInfoModel> linkResInfoModels);

    LinkResInfoModel getLinkResInfoRecentByName(@Param("accountName")String accountName);
}
